package com.manager.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.manager.data.StudentMapper;
import com.manager.data.StudentMapper2;
import com.manager.entity.StudentEntity;

@Controller
public class StudentController {
	
	@Autowired
	private StudentMapper studentMapper;
	
	@Autowired
	private StudentMapper2 studentMapper2;
	
	@RequestMapping(value = "/student")
	public ModelAndView studentDate(){
		
		StudentEntity student = studentMapper2.getStudentByid("12345");
		System.out.println("name:" + student.getName());
		
		student = studentMapper.getStudent("12345");
		System.out.println("name:" + student.getBirthday());
		
		 ModelAndView success = new ModelAndView("views/student/student");
		 success.addObject("name", student.getName());
		 success.addObject("birthday", student.getBirthday());
		
		 return success;
	}

}
